<%@ page import="javax.naming.InitialContext" %>
<%@ page import="javax.sql.DataSource" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.PreparedStatement" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="com.bdqn.dao.StuDaoImpl" %>
<%@ page import="com.bdqn.entity.Stu" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <title>我的首页</title>
</head>
<body>
<%
    //java代码
    //获取容器
    /*InitialContext context = new InitialContext();
    //容器通过JNDI查找数据源
    DataSource dataSource = (DataSource) context.lookup("java:comp/env/jdbc/news");
    //通过数据源连接池获取连接对象
    Connection connection = dataSource.getConnection();
    out.println(connection);

    //查询数据
    String sql="select * from stu";
    //基于数据库连接对象将SQL字符串预编译为语句
    PreparedStatement ps = connection.prepareStatement(sql);
    //执行语句
    ResultSet resultSet = ps.executeQuery();
    while (resultSet.next()){
        out.println("<p>"+resultSet.getInt(1)+"--"+resultSet.getString(2)+"</p>");
    }*/

    StuDaoImpl stuDao=new StuDaoImpl();
    Stu stu = new Stu("Jason","0001","男",1);
    //stuDao.delete(11);
    //stuDao.update(stu);
    stuDao.insert(stu);
    /*List<Stu> list=stuDao.show();
    out.println(list);*/



%>
</body>
</html>